package com.chenshu.test;

import com.chenshu.Obj;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2024-03-26
 * Time：21:43
 */
public class GetClass {
    public static void main(String[] args) throws ClassNotFoundException {
        //1
        String classPathName = "com.chenshu.Obj";
        Class cls1 = Class.forName(classPathName);

        //2
        Class cls2 = Obj.class;

        //3
        Obj obj = new Obj();
        Class cls3 = obj.getClass();

        //4
        ClassLoader classLoader = obj.getClass().getClassLoader();
        Class cls4 = classLoader.loadClass(classPathName);

        System.out.println(cls1.hashCode());
        System.out.println(cls2.hashCode());
        System.out.println(cls3.hashCode());
        System.out.println(cls4.hashCode());

        Class<Integer> integerClass = int.class;
        Class<Character> characterClass = char.class;
        System.out.println(integerClass);
        System.out.println(characterClass);

        Class<Integer> type = Integer.TYPE;
        Class<Character> type1 = Character.TYPE;
        System.out.println(type);
        System.out.println(type1);
    }
}
